package pers.wy.sell.converter;

import org.springframework.beans.BeanUtils;
import pers.wy.sell.domain.OrderMaster;
import pers.wy.sell.dto.OrderDTO;

import java.util.List;
import java.util.stream.Collectors;

/**
 * 转换器
 *
 * @Author: 月落
 * @Date: Created in 16:49 2018/9/7
 */
public class OrderMaster2OrderDTOConverter {

    public static OrderDTO convert(OrderMaster orderMaster) {
        OrderDTO orderDTO = new OrderDTO();
        BeanUtils.copyProperties(orderMaster, orderDTO);
        return orderDTO;
    }

    public static List<OrderDTO> convert(List<OrderMaster> orderMasters) {
        return orderMasters.stream().map(e ->
                convert(e)
        ).collect(Collectors.toList());
    }


}
